@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                订单列表
                
            </h1>
            <ol class="breadcrumb">
                <li><a href="/admin/order/index"><i class="fa fa-dashboard"></i>订单列表 </a></li>
                </li>
            </ol>
        </section>
        <!-- 订单删除失败 -->
        @if (session('error'))
            <div class="alert alert-danger alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <h4><i class="icon fa fa-check"></i>抱歉!</h4>
                        {{ session('error') }}
            </div>
        @endif
         <!-- 订单删除成功 -->
        @if (session('success'))
            <div class="alert alert-success alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <h4><i class="icon fa fa-check"></i>恭喜!</h4>
                        {{ session('success') }}
            </div>
        @endif
<!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            {{--分页--}}
                            <!-- 搜索订单,和当前页面的数据数 -->
                            <form action="/admin/order/index" method="get">
                            <div class="col-md-2">
                            <div class="form-group">
                                <select name="num" class="form-control">
                                <!-- 判断num的值,并选中 -->
                                    <option
                                    @if(!empty($request['num']) && $request['num'] == 10)
                                        selected
                                    @endif
                                    >10</option>
                                    <option
                                    @if(!empty($request['num']) && $request['num'] == 20)
                                        selected
                                    @endif
                                    >20</option>
                                    <option
                                    @if(!empty($request['num']) && $request['num'] == 50)
                                        selected
                                    @endif
                                    >50</option>
                                    <option
                                    @if(!empty($request['num']) && $request['num'] == 100)
                                        selected
                                    @endif
                                    >100</option>
                                </select>
                            </div>

                            </div>
                            
                       
                            <div class="col-md-3 col-md-offset-7">
                            <div class="input-group input-group-sm">
                                <input name="keywords" type="text" class="form-control" value="{{$request['keywords'] or ''}}">
                                <span class="input-group-btn">
                                  <button class="btn btn-info btn-flat">搜索!</button>
                                </span>
                            </div>
                            </div>
                            </form>
                        </div><!-- /.box-header -->
                        <!-- 订单列表 -->
                        <div class="box-body">
                            <table id="example2" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>订单编号</th>
                                    <th>收货人</th>
                                    <th>收货地址</th>
                                    <th>联系方式</th>
                                    <th>下单时间</th>
                                    <th>商品总金额</th>
                                    <th>支付方式</th>
                                    <th>订单留言</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $order)
                                <tr>
                                    <td>{{$order -> ordernum}}</td>
                                    <td>{{$order -> utname}}</td>
                                    <td>{{$order -> address}}</td>
                                    <td>{{$order -> uphone}}</td>
                                    <td>{{date('Y-m-d',$order -> atime)}}</td>
                                    <td>{{$order -> goods_price}}</td>
                                    <td>
                                    @if($order -> payway == 0)
                                        在线支付
                                    @elseif ($order -> payway == 1)
                                        微信支付
                                    @else
                                        货到付款
                                    @endif
                                    </td>
                                    <td>{{ $order -> content }}</td>
                                    <!-- 编辑和删除 -->
                                    <td>
                                    <a href="/admin/order/detail/{{$order -> ordernum}}" class="btn btn-block btn-info btn-xs">详情</a>
                                    <a href="/admin/order/edit/{{$order -> id}}" class="btn btn-block btn-success btn-xs">编辑</a>
                                    <a href="/admin/order/del/{{$order -> id}}" class="btn btn-block btn-danger btn-xs">删除</a>
                                    </td>
                                </tr>
                                @endforeach
                                </tfoot>
                            </table>
                            {!! $data->appends($request)->render() !!}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection
